package com.legal.aid.app.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "aliyun-oss")
public class OssConfig {
    @Value("${aliyun-oss.end-point}")
    private String endpoint;

    @Value("${aliyun-oss.access-key}")
    private String accessKeyId;

    @Value("${aliyun-oss.secret-key}")
    private String accessKeySecret;

    @Value("${aliyun-oss.bucket-name}")
    private String bucketName;

    @Value("${aliyun-oss.domain}")
    private String domain;

    @Value("${aliyun-oss.base-path}")
    private String basePath;

    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }

    public String getBucketName() {
        return bucketName;
    }

    public String getDomain() {
        return domain;
    }

    public String getBasePath() {
        return basePath;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public String getAccessKeyId() {
        return accessKeyId;
    }
} 